| Total Complexity | 1 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { DateTime } from 'luxon' |
||
| 5 | |||
| 6 | export default class Order extends BaseModel { |
||
| 7 | @column({ isPrimary: true }) |
||
| 8 | public id: number |
||
| 9 | |||
| 10 | @column() |
||
| 11 | public userId: number |
||
| 12 | |||
| 13 | @column() |
||
| 14 | public productId: number |
||
| 15 | |||
| 16 | @column() |
||
| 17 | public quantity: number |
||
| 18 | |||
| 19 | @column({ serialize: (value: number) => { |
||
| 20 | return value === 1 ? true : false |
||
| 21 | } |
||
| 22 | }) |
||
| 23 | public isSuccessful: number | boolean |
||
| 24 | |||
| 25 | @column.dateTime({ autoCreate: true }) |
||
| 26 | public createdAt: DateTime |
||
| 27 | |||
| 28 | @column.dateTime({ autoCreate: true, autoUpdate: true }) |
||
| 29 | public updatedAt: DateTime |
||
| 30 | |||
| 31 | @belongsTo(() => Product) |
||
| 32 | public product: BelongsTo<typeof Product> |
||
| 33 | |||
| 34 | @belongsTo(() => Merchant) |
||
| 35 | public merchant: BelongsTo<typeof Merchant> |
||
| 36 | } |
||
| 37 |